local extension = Package:new("mod_ex_cards", Package.CardPack)
extension.extensionName = "est_test"
extension:loadSkillSkels(require("packages.est_test.pkg.mod_ex_cards.skills"))
Fk:loadTranslationTable{
  ["mod_ex_cards"] = "逐云阁拓展额外牌",
}
local function getTrueSkills(player)
  local skills = {}
  for _, s in ipairs(player.player_skills) do
    if not (s.attached_equip or s.name[#s.name] == "&" or s.name == "m_feiyang" or s.name == "m_bahu" or s.name:startsWith("&")) then
      table.insertIfNeed(skills, s.name)
    end
  end
  return skills
end
local artofWar = fk.CreateCard{
  name = "&zyg__artofWar",
  type = Card.TypeEquip,
  sub_type = Card.SubtypeTreasure,
  equip_skill = "#zyg__artofWarSkill",
  on_uninstall = function(self, room, player)
    local targets = table.filter(room.alive_players, function(p)
      return p:getMark("@@artofWar_slash-turn") == 0
    end)
    targets = table.map(targets, Util.IdMapper)
    local skillnum = #getTrueSkills(player)
    if #targets > 0 and skillnum > 0 and not player.dead then
      local tos = room:askForChoosePlayers(player, targets, 1, skillnum, "#artofwar-choose", "zyg__artofWar", true) or {}
      if #tos > 0 then
        for _, id in ipairs(tos) do
          local p = room:getPlayerById(id)
          room:setPlayerMark(p, "@@artofWar_slash-turn", 1)
        end
      end
    end
  end,
}
Fk:loadTranslationTable{
  ["zyg__artofWar"] = "吴起兵书",
  [":zyg__artofWar"] = "装备牌·宝物<br/><b>宝物技能</b>："..
    "锁定技，当此牌离开你的装备区时，销毁之，然后你可以选择至多X名角色，本回合结束时，这些角色可以将一张牌当【杀】使用。（X为你的技能数）",
  ["#artofwar-choose"] = "选择任意名角色，本回合结束时令这些角色可以将一张牌当【杀】使用",
  ["#artofwar-ask"] = "你可以将一张牌当【杀】使用",
  ["#zyg__artofWarSkill"] = "吴起兵书",
  ["#zyg__artofWarActiveSkill"] = "吴起兵书",
  ["#artofWarSkill"] = "吴起兵书：你可以将一张牌当【杀】使用",
  ["#artofWarActiveSkill"] = "吴起兵书",
  ["@@artofWar_slash-turn"] = "吴起兵书",
}
extension:loadCardSkels{
  artofWar,
}
extension:addCardSpec("zyg__artofWar", Card.Spade, 1)
return extension